#!/bin/sh
#
# Run a simple backup
#   then verify the catalog.
#
TestName="verify-vol-tape"
JobName=VerifyVol
. scripts/functions

require_tape_drive

scripts/cleanup-tape
scripts/copy-tape-confs

change_jobname NightlySave $JobName

# Directory to backup.
# This directory will be created by setup_data().
BackupDirectory="${tmp}/data"

# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data data/small.tgz

# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
echo "${BackupDirectory}" >${tmp}/file-list


start_test

cat <<END_OF_DATA >tmp/bconcmds
@$out /dev/null
messages
@$out tmp/log1.out
setdebug level=1 storage=tape sd
label storage=tape volume=TestVolume001 pool=Default
run job=$JobName yes
wait
messages
@#
@# now do a verify volume
@#
@$out ${cwd}/tmp/original
run job=VerifyTape pool=Default
yes
wait
messages
quit
END_OF_DATA

run_susan

sleep 2
check_for_zombie_jobs storage=tape
stop_susan

grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
bstat=$?
grep "^  Termination: *Verify OK" ${cwd}/tmp/original 2>&1 >/dev/null
rstat=$?
dstat=0
end_test
